package StuManagerSystem.service;

import java.util.Scanner;

public class LoginService {

	public static String login() {

		Scanner sc = new Scanner(System.in);

		// 角色选择
		Integer number;

		// 声明用户名和密码
		String username, password;
		out: while (true) {
			System.out.print("\t\t请选择：");
			number = sc.nextInt();
			switch (number) {
			case 1:
				System.out.println("***************************************************");
				System.out.println("\t\t学生登录界面");
				System.out.print("\t\t用户名：");
				username = sc.next();
				System.out.print("\t\t密码：");
				password = sc.next();
				System.out.println("***************************************************");
				break out;
			case 2:
				System.out.println("***************************************************");
				System.out.println("\t\t教师登录界面");
				System.out.print("\t\t用户名：");
				username = sc.next();
				System.out.print("\t\t密码：");
				password = sc.next();
				System.out.println("***************************************************");
				break out;
			case 3:
				System.out.println("***************************************************");
				System.out.println("\t\t管理员登录界面");
				System.out.print("\t\t用户名：");
				username = sc.next();
				System.out.print("\t\t密码：");
				password = sc.next();
				System.out.println("***************************************************");
				break out;
			case 4:
				System.out.println("\t\t感谢您使用学生管理系统，再见！");
				//退出jvm
				System.exit(0);
			default:
				System.out.println("\t\t选择角色出错，请重新输入！");
				continue out;
			}
		}
		return number + "," + username + "," + password;
	}
}
